package com.leyou.comtroller;

import com.leyou.domain.Role;
import com.leyou.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping
public class RoleController {

    @Autowired
    private RoleService roleService;

    @GetMapping("/queryRole")
    public ResponseEntity<List<Role>> queryRoles(){
        List<Role> roles = roleService.queryRoles();
        return ResponseEntity.ok(roles);
    }

    @GetMapping("/findRoles")
    public ResponseEntity<List<Role>> findRoles(Long uid){
        List<Role> roles = roleService.findRoles(uid);
        return ResponseEntity.ok(roles);
    }

}
